import { makeAutoObservable } from "mobx";
import Api from './../api/index';
import Axios from './../util';
class user {
  constructor() {
    makeAutoObservable(this)
  }
  // 被观察者属性
  token=''
  userInfo=''
  login(values){
    return new Promise((resolve,reject)=>{
      Axios.post(Api.Login.login, {userName:values.username,userPwd:values.password}
      ).then((res)=>{
        // console.log(res)
        if(res.data.returnCode===200){
          this.user = res.data.data;
          this.token = res.data.token;
          resolve('登录成功')
        }else{
          reject('登录失败')
        }
      })
    })
  }
}
export default  user;